<template>
  <div>
    <a-modal
      title="请选择下一经办人"
      :visible="visible"
      :confirm-loading="confirmLoading"
      @ok="handleOk"
      @cancel="handleCancel"
    >
      <a-radio-group v-model="candidateUser">
        <a-radio v-for="user in users" :value="user" :key="user">{{user}}</a-radio>
      </a-radio-group>
    </a-modal>
  </div>
</template>
<script>
export default {
  name: 'CandidateUsers',
  props: {
    sequenceId: ''
  },
  data () {
    return {
      users: [],
      candidateUser: '',
      visible: false,
      confirmLoading: false
    }
  },
  methods: {
    showModal () {
      this.visible = true
    },
    closeModal () {
      this.confirmLoading = false
      this.visible = false
    },
    handleOk () {
      this.confirmLoading = true
      this.$emit('setCandidateUser', this.candidateUser, this.sequenceId)
      setTimeout(() => {
        this.visible = false
        this.confirmLoading = false
      }, 2000)
    },
    handleCancel () {
      this.visible = false
    },
    setUsers (data) {
      this.users = data
    }
  }
}
</script>
